<?php

//  防止全局变量造成安全隐患
$admin = false;
//  启动会话，这步必不可少
session_start();
//  判断是否登陆
if (isset($_SESSION["admin"]) && $_SESSION["admin"] === true) {
  
      //起始位置
  header("Content-type:application/vnd.ms-excel");
//定义输出的文件名，表示输出的文件名为test.xls,如果文件名为中文，用iconv函数进行转码
header("Content-Disposition:filename=mingdan.xls");

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<?php




 include"conn.php";
  $sql="select * from mj ";
 $query=mysql_query($sql);


?>
  
      
      <!--startprint-->
      <div class="timetable">
        <table border="1" style="text-align: center;" cellspacing="1" cellpadding="1">
            <tr>
            <th colspan="8" scope="col">报名列表</th>
          </tr>
          <tr>
            <th width="40px" scope="col">序号</th> 
			  	<th width="120px" scope="col">姓名</th>   
				<th width="200px" scope="col">班级</th>
				<th width="150px"scope="col">手机号码</th>
				<th width="120px"scope="col">QQ</th>
				<th scope="col">你学习过编程吗？</th>
				<th scope="col">你是否有一手比较精通或者熟练的技术？</th>
				<th scope="col">你为什么要加入本协会？</th>
                <th scope="col">报名时间</th>
				
            
          </tr>
          <?php
		  $i=1;
         while (  $ww=mysql_fetch_array($query)){
		
		?>  
          
          
          <tr>
            <td align="center"><?php  echo $i++;   ?></td>
            <td align="center"><?php  echo htmlspecialchars($ww['name']);   ?></td>
            <td align="center"><?php  echo htmlspecialchars($ww['classname']);   ?></td>
            <td align="center"><?php  echo htmlspecialchars($ww['phone']);   ?></td>
            <td align="center"><?php  echo htmlspecialchars($ww['qq']);   ?></td>
            <td align="center"><?php  echo htmlspecialchars($ww['study']);   ?></td>
            <td align="center"><?php  echo htmlspecialchars($ww['technology']);   ?></td>
            <td align="center"><?php  echo htmlspecialchars($ww['why']);   ?></td>
            <td align="center"><?php  echo $ww['etime'];   ?></td>
          </tr>
          
          <?php
		 }
		 
		 
		 
		  ?>
          
      
        </table>
        
        </div>


</body>
<?php
} else {
    //  验证失败，将 $_SESSION["admin"] 置为 false
    $_SESSION["admin"] = false;
    die( "<script>location.href='login.php';</script>");
}
?>
</html>